home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 14 / CU Amiga Magazine's Super CD-ROM 14 (1997)(EMAP Images)(GB)(Track 1 of 3)[!][issue 1997-09].iso / CUCD / Programming / SAS-C / sc655pch / mount / readme.txt < prev    next >
Encoding:
Text File  |  1995-01-11  |  3.1 KB  |  76 lines

  1. This code is provided as-is, for instructional purposes only.  You may 
  2. redistribute it or use it as you like, but by doing so you hold the authors
  3. and distributors harmless for any damages it may cause.  This code is 
  4. Copyright (c) 1994-1995 Doug Walker, All Rights Reserved.
  5.  
  6. Here are two functions that will mount and dismount a volume node in the 
  7. DOS list, assigning all incoming messages to a specific port OTHER THAN the
  8. one in the Task structure.
  9.  
  10. If you are writing a handler, this gives the following advantages:
  11.  
  12.    1. No need for mountlist entries or using Mount to mount your file 
  13.       system - use configuration files instead.
  14.    
  15.    2. You can run as a normal process instead of a Task, which means you 
  16.       can use your normal debugger, printf(), stdin, stdout, etc. and the
  17.       user can start your handler from WorkBench or Shell like any other
  18.       program.
  19.  
  20. I recommend that you use the cback.o startup to detach your handler from
  21. the shell that invoked it.
  22.  
  23. The following two functions are provided:
  24.  
  25.    struct DeviceList *Mount(char *name, struct MsgPort *port);
  26.  
  27.       Mounts a volume with the given name and assigns all incoming DOS 
  28.       packets to the specified MsgPort.
  29.  
  30.    int DisMount(struct DeviceList *volume);
  31.  
  32.       Dismounts a volume, given a pointer to its volume node.  Must be a 
  33.       volume that was mounted with Mount().
  34.  
  35. If you have SAS/C, simply enter this directory in the Shell and type 
  36. "scsetup" followed by "smake" to compile and link the test program.  This 
  37. distribution consists of four files:
  38.  
  39.    test.c     - Test program.
  40.    mount.h    - Prototypes for Mount() and DisMount().
  41.    mount.c    - Version of Mount() and DisMount() that works on any 
  42.                 version of AmigaDOS
  43.    mountv37.c - Version of Mount() and DisMount() for version 37 and up 
  44.                 (AmigaDOS 2.0 and above)
  45.  
  46. When you use smake, it links a program called "test" and one called 
  47. "testv37".  The latter is linked with mountv37.c and will only work on 
  48. AmigaDOS 2.0 and above.
  49.  
  50. To run the test program, type "test foo".  This will mount a volume node
  51. called "foo".  The test program will print any packets that it receives,
  52. then immediately reject them with an ERROR_ACTION_NOT_KNOWN response.
  53. Packet type 8 is a LOCK packet; if you are running WorkBench, you'll see
  54. one of these come up every so often as WorkBench tries to figure out what
  55. the new volume is.
  56.  
  57. You can send other packets as well.  Try opening another Shell and doing a
  58. COPY command to foo:
  59.  
  60.    COPY s:startup-sequence to FOO:
  61.  
  62. You'll see some new packet types as COPY attempts to open a file in your
  63. FOO: device.  (The copy will fail, of course).  If you are writing a
  64. handler, you should find a copy of PickPacket, written by Doug Walker and
  65. John Toebes.  This testing utility lets you generate and send any packet
  66. type you like, as long as it existed when PickPacket was written (!).
  67. PickPacket is on Fred Fish disk #227.
  68.  
  69. IMPORTANT NOTE: The test program isn't designed perfectly; it's a 
  70. proof-of-principle, but it does have some multitasking "holes" in it.
  71. Writing a good handler is left as an exercise for the reader 8^)
  72.  
  73. Happy programming!
  74.  
  75.    --Doug Walker
  76.